export function delay(ms){
    return new Promise((resolve,reject)=>{
        setTimeout(()=>{
            resolve();
            /* let result = Math.random();
            if(result>.5){
                resolve(result);
            }else{
                reject('失败');
            } */
        },ms);
    });
}
//通过一个标记符来表示成功失败
export function delay2(ms){
    return new Promise((resolve,reject)=>{
        setTimeout(()=>{
            let result = Math.random();
            if(result>.5){
                resolve({code:0,data:result});
            }else{
                resolve({code:1,data:'失败'});
            }
        },ms);
    });
}

export function delay3(ms){
    return new Promise((resolve,reject)=>{
        setTimeout(()=>{
            resolve(Math.random());
        },ms);
    });
}
